package com.example.mobile2021606177cke0401;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

    private TextView tvMainTitle;
    private Button btnMainLightOff;
    private Button btnMainLightOn;
    private ImageView ivMainLight;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        btnMainLightOn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ivMainLight.setImageResource(R.drawable.light_on);
                ;
            }
        });
        btnMainLightOff.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ivMainLight.setImageResource(R.drawable.light_off);
            }
        });
    }

    private void initView() {
        tvMainTitle = (TextView) findViewById(R.id.tv_main_title);
        btnMainLightOff = (Button) findViewById(R.id.btn_main_lightOff);
        btnMainLightOn = (Button) findViewById(R.id.btn_main_lightOn);
        ivMainLight = (ImageView) findViewById(R.id.iv_main_light);
    }
}